
<div class="container-fluid">

            <div class="row-fluid">
                <div class="span12">
                    <h3 class="page-title">
                        用户管理 <small>用户列表</small>
                    </h3>
                    <ul class="breadcrumb">
                        <li>
                            <i class="icon-home"></i>
                            <a href="index.html">用户管理</a> 
                            <i class="icon-angle-right"></i>
                        </li>
                        <li><a href="#">用户列表</a></li>
                      
                    </ul>
                    <!-- END PAGE TITLE & BREADCRUMB-->
                </div>
            </div>
            
            
            
  

            <div class="row-fluid"> 

                <div class="portlet box blue">
                        <div class="portlet-title">
                                <div class="caption"><i class="icon-cogs"></i>用户列表</div>
                            
                                 <div class="actions">
                                     <a href="<?php echo Yii::app()->createUrl('xyhadm/user/add')?>" class="btn green" ><i calss="icon-pencil"></i>添加用户</a>
                                </div>  
                        </div>
                    
                       

                    <div class="portlet-body">
                          <?php
            $this->widget('bootstrap.widgets.TbGridView', array(
                'id' => 'table-breaking',
                'dataProvider' => $User->search(),
                'filter' => $User,
                //'enableHistory' =>'true',
                'afterAjaxUpdate' => 'reinstallDatePicker',
                'htmlOptions' =>array('class'=>'table table-hover'),
                'summaryText' => '<font color="#0066A4"; style="float:right">显示{start}-{end}条.共{count}条记录,当前第{page}页</font>', 
                'columns' => array(
                    array(
                        'name' => 'id',
                         'value' => '$data->id',
                       // 'htmlOptions' =>array('style'=>'width:10px;'),
                        //'filter'=>FALSE
                    ),
                     array(
                        'name' => 'mobile',
                        'header'=>'手机',
                        'value' => '$data->mobile',
                       // 'htmlOptions' =>array('style'=>'width:80px;'),
                    ),
                     array(
                        'name' => 'username',
                        'header'=>'用户名',
                        'value' => '$data->username',
                        //'htmlOptions' =>array('style'=>'width:20px;'),
                    ),
                    
                    array(
                        'name' => 'gender',
                        'header'=>'性别',
                        'value' => '$data->gender==1?"男":"女"',
                        'filter'=>array('1'=>'男','2'=>'女'),
                        'htmlOptions' =>array('style'=>'width:auto;'),
                    ),
                    array(
                        'name' => 'city_id',
                        'header'=>'城市',
                        'value' => '$data->city_id?$data->Area->name:"未知"',
                        'filter'=>  CHtml::dropDownList('User[city_id]','',CHtml::listData(Area::model()->findAllByAttributes(array('grade'=>2)),'id', 'name'),array(
                            'empty'=>'全部'
                        )),
                          'htmlOptions' =>array('style'=>'width:auto;'),
                    ),
                        array(
                        'name' => 'profession_id',
                        'header'=>'行业',
                        'value' => '$data->profession_id?$data->Profession->name:"未知"',
                        'filter'=> CHtml::listData(Profession::model()->findAllByAttributes(array('status'=>1)),'id', 'name'),
          
                       // 'htmlOptions' =>array('style'=>'width:80px;'),
                    ),
                    
                    

                    array(
                        'name' => 'ctime',
                        'header'=>'创建时间',
                        'value' => 'date("Y-m-d",$data->ctime)',
                         'filter' => $this->widget('zii.widgets.jui.CJuiDatePicker', array(
                            'model' => $User,
                            'attribute' => 'ctime',
                            'language' => 'zh',              
                            'htmlOptions' => array(
                                'id' => 'datepicker_for_due_date',                       
                                'style' => 'height:20px;width:80px;',
                            ),
                            'options' => array(// 
                                'showAnim' =>'slideDown',
                                'dateFormat' => 'yy-mm-dd',
                                 'firstDay'=>1,
                                'showButtonPanel' => true,
                            )
                                ), true), //
                        // 'htmlOptions' =>array('style'=>'width:80px;'),
                    ),
                    
                    array(
                   'header' => '操作',
                   'class' => 'bootstrap.widgets.TbButtonColumn',

                   'template' =>'{view}|{edit}|{delete}',

                   //'htmlOptions' => array('style' => 'width:100px'),
                   'buttons' => array(
                       'view' => array(
                           'label' => '查看',
                           'url' => 'Yii::app()->createUrl("xyhadm/user/view",
                                   array(
                                           "id"=>$data->id,
                                        ))',
                          'options' => array(
                                    'data-toggle' => 'modal',
                                    'data-target' => '#view', 
                                    'class'=>'label label-info'
                           ),
                         ),
                       'edit'=>array(
                            'label' => '修改',
                             'url' => 'Yii::app()->createUrl("xyhadm/user/edit",
                                   array(
                                           "id"=>$data->id,
                                        ))',
                           'options'=>array('class'=>'btn green mini')

                       ),
                       'delete'=>array(
                           'label' =>'删除',
                           'options'=>array(
                                'class'=>'label label-danger'
                           )
                           
                       ),
                        'jinzhi'=>array(
                           'label' =>'禁止',
                           'url' =>'"javascript:is_status(\"".$data->id."\",\"".$data->status."\");"',
                           'options'=>array('class'=>'btn red mini')

                       ),
                       
//                        'edit1'=>array(
//                            'label' => '修改1',
//                             'url' => 'Yii::app()->createUrl("xyhadm/activity/ajaxedit",
//                                   array(
//                                           "id"=>$data->id,
//                                        ))',
//                              'options' => array(
//                                    'data-toggle' => 'modal',
//                                    'data-target' => '#edit', 
//                           ),
//
//                       ),
                      

                       ),        
                   ),
                    
                    
                    
                    
           
               
               ),
                
            ));
            
             Yii::app()->clientScript->registerScript('re-install-date-picker',"
            function reinstallDatePicker(id, data){ 
                $('#datepicker_for_due_date').datepicker(jQuery.extend(jQuery.datepicker.regional['en'],{'dateFormat':'yy-mm-dd'}));//
               
}");
 
            ?> 
                </div>
                        
                        
               </div>    
            </div>
</div>

<!-- 查看 -->

<div class="modal fade" style="width: 1050px; margin: -10px 0 0 -450px;" id="view"  tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
   <div class="modal-dialog">
        <div class="modal-content" id="prepaidData-content" style="width: 1050px; margin: -10px 0 0 -450px;">
        
            
        </div>      
    </div>  
</div>






<script type="text/javascript">



 function is_status(id,status){
       if(status ==2){
           $.fn.yiiGridView.update('table-breaking',{
            type:'POST',
            url:$(this).attr('href'), 
             data:{'id':id,'status':status},
        });
        
       }else{
           alert('已采纳');
           return false;
       }
    }


$('#view').on('hidden.bs.modal',function(e){
    $('div.modal-backdrop.fade.in').remove();
     history.go(0);
});



</script>